<!DOCTYPE html>
<html lang="ch">

<head>
	<meta charset="utf-8">

	<title>合合乐</title>
	<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
	<meta name="apple-mobile-web-app-capable" content="yes">
	<script type="text/javascript" charset="utf-8">
		window.addEventListener('touchmove', function (event) { event.preventDefault(); }, { capture: false, passive: false });
		if (typeof window.devicePixelRatio != 'undefined') {
			var meta = document.getElementById("viewport");
			var scale = 2 / window.devicePixelRatio;
			if (window.devicePixelRatio <= 2) {
				scale = 1 / window.devicePixelRatio;
			}
			scale = 1;
			meta.setAttribute('content', 'width=device-width, initial-scale=' + scale);
		}

		var version = new Date().getTime();
		var trace = console.log;
		var list = ["game.js", "lib/pako.min.js", "lib/howler.min.js"];
		// list.push("lib/vconsole.min.js");
		var count = list.length;

		
		function versionSuccess() {
			var len = count;
			while (len-- > 0) { load(list[len] + "?" + version, init) }
		}

		function load(url, callback) {
			var scriptElement = document.createElement('script');
			scriptElement.type = 'text/javascript';
			scriptElement.charset = 'utf-8';
			document.getElementsByTagName('head')[0].appendChild(scriptElement);
			scriptElement.onload = function () { callback(); }
			scriptElement.src = url;
		}

		function init() {
			if (--count > 0) return;
			// var vConsole = new VConsole();
			var renderCanvas = document.getElementById("webgl");
			var input = document.getElementById("input");
			var w = window.innerWidth;
			var h = window.innerHeight;
			var rot = 0;
			if (h > w) {
				var nw = h;
				var nh = w;

				renderCanvas.style.top = (h - nh) * 0.5 + "px";
				renderCanvas.style.left = (w - nw) * 0.5 + "px";
				renderCanvas.style.transform = "rotate(90deg)"
				w = nw;
				h = nh;
				rot = 90;
			}
			renderCanvas.width = w;
			renderCanvas.height = h;
			var config = { init: gameInit, canvas: renderCanvas, version: version, rotation: rot };
			if (location.search.length > 1) {
				config["get"] = location.search.substring(1);
				LoveDNA.setParam("location.search", location.search.substring(1));
			}
			LoveDNA.setParam("web.renderCanvas", renderCanvas);
			LoveDNA.setParam("web.canvasRotation", rot);
			LoveDNA.setParam("init", gameInit);
		}
		function gameInit() {
			document.getElementById("loading").style.display = "none";
		}


		window.TestClass = function () {
		}
		window.TestClass.prototype = {
			testFun: function (msg) {
				alert(msg);
			}
		};

		function callAndroid(funName, args) {
			var result = prompt("js://" + funName + "?" + args);
			return result;
		}
		load('version.js?' + version, versionSuccess);
	</script>
	<style>
		html,
		body {
			margin: 0;
			padding: 0;
			height: 100%;
			overflow: hidden;
		}

		.bg {
			background: #00000000;
			position: absolute;
			left: 0px;
			top: 0px;
			width: 100%;
			height: 100%;
			background: linear-gradient(to bottom, #285b96, #0977df);
		}

		

		.tip {
			background: linear-gradient(to bottom, #000000, #000000);
			pointer-events: none;
			position: absolute;
			width: 100%;
			height: 100%;
			text-align: center;
			display:flex;
			align-items: center;
		}

		.game {
			position: absolute;
			left: 0px;
			top: 0px;
			width: 100%;
			height: 100%;
		}
		.Splash{
			width: 100%;
		}
	</style>

</head>

<body>
	<div class="bg"><canvas class="game" id="webgl"></canvas></div>
	<div class="tip" id="loading"><img class="Splash" src="UnitySplash-cube.png" title="splash"></div>

</body>

</html>